//
//  DeviceCheckIn.m
//  work
//
//  Created by 方伟 on 16/6/15.
//  Copyright © 2016年 方伟. All rights reserved.
//

#import "DeviceCheckIn.h"
static DeviceCheckIn *instance = nil;

@implementation DeviceCheckIn


+(instancetype)shareManager
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[super allocWithZone:nil] init];
        
    });
    
    [instance initialize];
    return instance;
}

+(instancetype)allocWithZone:(struct _NSZone *)zone
{
    return [self shareManager];
}

-(id)copy
{
    return self;
}



-(void) initialize{
    Locatianmanager *location = [Locatianmanager shareManager];
    location.delegate = self;
    
    
}



-(void)startRequst{


    ZhuangxiuManager *zhuangxiumanager = [ZhuangxiuManager shareManager];

    if (_longitude.length==0 || _latitude.length == 0) {
        _latitude = @"-1";
        _longitude = @"-1";

    }
    
    NSDictionary *parameters;
    
    if (zhuangxiumanager.sessionid.length > 0) {
        parameters = @{@"lat":_latitude,
                                     @"lng":_longitude,
                                     @"obj_id":zhuangxiumanager.worker_id,
                                     @"channel_id":zhuangxiumanager.channel_id,
                                     @"session_id":zhuangxiumanager.sessionid

                                     };
    }else{
    
        parameters = @{@"lat":_latitude,
                                     @"lng":_longitude,
                                     @"obj_id":zhuangxiumanager.worker_id,
                                     @"channel_id":zhuangxiumanager.channel_id
                       
                                     };
        
    }
    
    NSLog(@"1111111111%@",parameters);
    _networkTool = [NetworkTooler new];
    _networkTool.delegate = self;
    NSLog(@"%@",zhuangxiumanager.channel_id);
    
    
    
    
    [_networkTool parameters:parameters withURL:deviceCheckIn_show withIsPaparameters:YES];

}

-(void)returnlongitude:(NSString *)longitude withlatitude:(NSString *)latitude{

    _latitude = latitude;
    _longitude = longitude;
    
    [self startRequst];
    

}
- (void)returnData:(id)data{
 
    NSLog( @"1111111111");


}
- (void)returnRequestError:(NSError *)error{

    NSLog( @"2222222222");

}
- (void)returnMsg:(NSString *)Msg{
    
    if (Msg.length == 0) {
        
        NSLog( @"33333333333");
    }else{
        NSLog( @"%333333333333@",Msg);

    
    }


}
@end
